package com.xbongbong.paas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;

import java.util.Arrays;
import java.util.List;

/**
 * 范围筛选类型
 *
 * @author: hongxiao
 * @date: 2020-03-03 20:27
 * @since:
 */
public enum RangeScreenTypeEnum {

    /**
     * 范围筛选的四种类型
     */
    ME(-1, "me", "enum.rangeScreenType.memo.me"),
    MY_SUB(-2, "mySub", "enum.rangeScreenType.memo.my_sub"),

    DEPARTMENT(-3, "dept", "enum.rangeScreenType.memo.department"),
    STAFF(-4, "staff", "enum.rangeScreenType.memo.staff"),
    ;


    private Integer type;

    private String alias;

    private String memo;

    RangeScreenTypeEnum(Integer type, String alias, String memo){
        this.type =type;
        this.alias = alias;
        this.memo = memo;
    }

    public Integer getType() {
        return type;
    }

    public String getAlias() {
        return alias;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }

    public static RangeScreenTypeEnum getRangeScreenTypeEnum(Integer type){
        for (RangeScreenTypeEnum screenTypeEnum: values()){
            if(screenTypeEnum.getType().equals(type)){
                return screenTypeEnum;
            }
        }
        return null;
    }
    /**
     * 获取选项描述
     * @param type
     * @return java.lang.String
     * @author zcp
     * @date 2019/6/30 21:09
     * @since v1.0
     * @version v1.0
     */
    public static String getScreenTypeMemo(Integer type){
        for (RangeScreenTypeEnum screenTypeEnum: values()){
            if(screenTypeEnum.getType().equals(type)){
                return screenTypeEnum.getMemo();
            }
        }
        return null;
    }
}
